package emailModule;

import java.util.Properties;

import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;

public class emailSender {
	public static void SendEmail(String to, String MsgSubject, String MsgBody){
	    Properties props = new Properties();
	    Session session = Session.getDefaultInstance(props, null);
		try {
			Message msg = new MimeMessage(session);

			msg.setFrom(new InternetAddress("auction.notifier@gmail.com"));
			msg.addRecipient(Message.RecipientType.TO,
					new InternetAddress(to));
			msg.setSubject(MsgSubject);
			msg.setContent(MsgBody, "text/html");
			//  msg.setText(MsgBodyString);
			Transport.send(msg);

		} catch (AddressException e) {
			// ...
		} catch (MessagingException e) {
			// ...
		}
	}

	
 
}
